using System;
using System.Collections.Generic;

namespace Nairo.Parser.Dom
{
	public class CommentBlock : AbstractBlock
	{
		string text;
	
		public CommentBlock(FileUnit file, string text, INode parent, object userData)
			: base(file, parent, new List<INode>(), userData)
		{
			this.text = text.Remove(0, 4);
			this.text = this.text.Remove(this.text.Length - 4);
			this.text = this.text.Trim();
		}
		
		public string Text {
			get { return text; }
			set { text = value; }
		}
		
		public override INode GetTag(string name)
		{
			throw new NotSupportedException("A comment has no tag name!");
		}
		
		public override INode[] GetTags(string name)
		{
			throw new NotSupportedException("A comment has no tag name!");
		}
		
		public override object AcceptChildren(IDomVisitor visitor, object data)
		{
			throw new NotImplementedException();
		}
		
		public override object AcceptVisitor(IDomVisitor visitor, object data)
		{
			return visitor.VisitCommentBlock(this, data);
		}
	}
}
